package com.dinim.test.objectlibrary;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

import com.dinim.physics2D.OBBContactResolver;
import com.dinim.test.AbstractTest;

public class OBBContactResolverTester extends AbstractTest{

    public OBBContactResolverTester(int width, int height) {
        super(width, height);
//        objects.add(new Rectangle2D(10, 10, 1000, 1000));
//        objects.add(new Rectangle2D(20, 20, 100, 100));
        addRandomObjects(5);
        rotateAllObjectsConstantly(15.15);
    }

    public static void main(String[] args) {

        OBBContactResolverTester obbcrt = new OBBContactResolverTester(400, 400);
        OBBContactResolver obbcr = new OBBContactResolver(obbcrt.objects);
        
        obbcrt.refreshCanvas();
        obbcrt.drawAllObjectBoundingBoxes();
        obbcrt.paint();
        
        for(int i = 0; i < 50; i++){
            obbcrt.startStopWatch(DEFAULT_STOPWATCH);
            obbcr.resolve();
            obbcrt.stopStopWatch(DEFAULT_STOPWATCH);
            System.out.println("time: " + obbcrt.getStopWatchTime(DEFAULT_STOPWATCH));
        }

        while(true){
            obbcrt.startStopWatch(DEFAULT_STOPWATCH);
            //obbcrt.rotateAllObjectsConstantly(1.15);
            obbcrt.refreshCanvas();
            //obbcrt.drawAllObjects();
            obbcrt.drawAllObjectBoundingBoxes();
            obbcrt.paint();
            obbcrt.stopStopWatch(DEFAULT_STOPWATCH);
            long et = obbcrt.getStopWatchTime(DEFAULT_STOPWATCH);
            if(et > 16){
                System.out.println(et);LinkedList l = new LinkedList();
            }
        }
    }
}
